#include "Bullet.h"

using namespace YoghurtGum;

Bullet::Bullet(float a_X, float a_Y) : Entity(a_X, a_Y)
{
	m_X = a_X;
	m_Y = a_Y;
	m_Sprite = Root::GetSingleton().GetRenderer()->CreateSprite("bullet");

	SetDepth(100.f);
}

void Bullet::Update()
{
	m_Y -= 2;
	if (m_Y < -5) { Scene::Get()->DeleteObject(this); }

	Entity* collide = Scene::Get()->CheckCollision(this);
	if (collide && m_Y < 200)
	{
		Scene::Get()->DeleteObject(this);
		Scene::Get()->DeleteObject(collide);
	}
}